const state = () => ({
  // 存储 用户 昵称
  username:"",
  // 存储用户等级
  vip:""
});

const mutations = {
  // 初始化 数据
 setuserinfo(state,data){
    state.username = data.username;
    state.vip = data.vip;
 },
}

const actions = {
  setuserinfo({commit},data){
    commit("setuserinfo",data);
 }
}


const getters = {
  // 获取用户昵称
  getusername: state => {
    return state.username;
  },
  // 获取用户等级
  getuservip: state => {
    return state.uservip;
  }
}

export default{
  namespaced:true,
  state,
  actions,
  mutations,
  getters
}